document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px';
window.onresize = function () {
    // window.location.reload();
}


/*
 * GLOBAL VARIABLE
 */
var global = {
    localhost:"http://als.tjliwu.cn/", //request address
    titleName:'阿拉膳（天津）健康科技集团'
}



document.getElementsByTagName("title")[0].innerText = global.titleName;

/*
 *BAI DU API USE
 * PAGE IMPORT <script src="http://api.map.baidu.com/api?v=2.0&ak=个人百度地图钥匙"></script>
 * selector 选择器
 * point 经度 纬度 对象
 * mapLabel 地图标识文字
 * mapLabelStyle 地图标识样式对象
 */
function BDMap(selector,point,mapLabel,mapLabelStyle) {
    var map = new BMap.Map(selector);
    map.centerAndZoom(new BMap.Point(point.longitude,point.latitude),14);
    map.enableScrollWheelZoom(true);
    map.clearOverlays();
    var new_point = new BMap.Point(point.longitude,point.latitude);
    var marker = new BMap.Marker(new_point);
    map.addOverlay(marker);
    var label = new BMap.Label(mapLabel,{offset:new BMap.Size(20,-10)});
    label.setStyle(mapLabelStyle)
    marker.setLabel(label);
    map.panTo(new_point);
}
/*
 *  GET SEARCH FROM URL
 */
function getSearch() {
    var searchUrl = window.location.search;
    searchUrl = searchUrl.substring(1,searchUrl.length);
    var urlParam = searchUrl.split("&");
    return urlParam;
}
function sendAjax(url,callback,data){
    $.ajax({
        url:url,
        data:data,
        dataType:"json",
        success:function (res) {
            callback(res)
        }
    })
}
/*
 * 选项卡选定内容
 */
function navSelect(selector01,selector,index,navText){
    $(selector01).removeClass("active");
    $(selector01).eq(index).addClass("active");
    $(selector).css("display","none");
    $(selector).eq(index).css("display","block");
    $("#main-content .title").text(navText);
}
$(document).ready(function () {
    /*
     *  page select change
     */
    $(".nav-list").on("click","li",function () {
        var that = this;
        var index = $(this).index();
        var navText = $(this).text();
        navSelect(".nav-list li",".item",index,navText);
    })
    /*
    * page jump &获取 item
    */
    var urlParam = getSearch();
    var item = urlParam[0].split("=")[1];
    var navText = $(".nav-list li").eq(item).text();
    navSelect(".nav-list li",".item",item,navText);
    /*
     * footer all use
     */
    $("footer").load("temp/footer.html");
})